303c53f4e9851a3f0eb081b8981c4fbae2a56c37,maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java,AntBuildWriterUtil,getMavenPluginConfigurationsImpl,#MavenProject#String#String#String#,1079
Before Change
XObject obj = XPathAPI.eval( doc, "//configuration/" + optionName );
NodeList nodeList = obj.nodelist();
if ( nodeList.getLength() > 0 && isList( nodeList.item( 0 ) ) )
{
/*
* <optionNames>
* <optionName>
* <param1>value1</param1>
* <param2>value2</param2>
* </optionName>
* </optionNames>
*/
Map options = new HashMap();
List optionNames = new ArrayList();
NodeList childs = nodeList.item( 0 ).getChildNodes();
for ( int i = 0; i < childs.getLength(); i++ )
{
if ( childs.item( i ).getNodeType() == Node.ELEMENT_NODE )
{
Map option = new HashMap();
obj = XPathAPI.eval( doc, "//configuration/" + childs.item( i ).getNodeName() );
if ( StringUtils.isNotEmpty( obj.toString() ) )
{
Map properties = new HashMap();
NodeList childs2 = childs.item( i ).getChildNodes();
if ( childs2.getLength() > 0 )
{
for ( int j = 0; j < childs2.getLength(); j++ )
{
if ( childs2.item( j ).getNodeType() == Node.ELEMENT_NODE )
{
properties.put( childs2.item( j ).getNodeName(), childs2.item( j )
.getFirstChild().getNodeValue() );
}
}
option.put( childs.item( i ).getNodeName(), properties );
}
}
else
{
option.put( childs.item( i ).getNodeName(), childs.item( i ).getFirstChild()
.getNodeValue() );
}
optionNames.add( option );
After Change
.parse( new ByteArrayInputStream( pluginConf.toString().getBytes( "UTF-8" ) ) );
NodeList nodeList = XPathAPI.eval( doc, "//configuration/" + optionName ).nodelist();
if ( nodeList.getLength() > 0 )
{
Node optionNode = nodeList.item( 0 );
if ( isList( optionNode ) )
{
/*
* <optionNames>
* <optionName>
* <param1>value1</param1>
* <param2>value2</param2>
* </optionName>
* </optionNames>
*/
Map options = new HashMap();
List optionNames = new ArrayList();
NodeList childs = optionNode.getChildNodes();
for ( int i = 0; i < childs.getLength(); i++ )
{
Node child = childs.item( i );
if ( child.getNodeType() == Node.ELEMENT_NODE )
{
Map option = new HashMap();
if ( isElementContent( child ) )
{
Map properties = new HashMap();
NodeList childs2 = child.getChildNodes();
if ( childs2.getLength() > 0 )
{
for ( int j = 0; j < childs2.getLength(); j++ )
{
Node child2 = childs2.item( j );
if ( child2.getNodeType() == Node.ELEMENT_NODE )
{
properties.put( child2.getNodeName(), getTextContent( child2 ) );
}
}
option.put( child.getNodeName(), properties );
}
}
else
{
option.put( child.getNodeName(), getTextContent( child ) );
}
optionNames.add( option );